\documentclass{standalone}
\usepackage{ctex}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\usepackage{amsmath}

\begin{document}
	
		\begin{tikzpicture}
	\begin{axis}[
		axis lines = center,
		xlabel = \(x\),
		ylabel = {\(y\)},
		xmin = -4.0, xmax = 4.5,
		ymin = -4.0, ymax = 4.5,
		% 关键修复：设置角度单位为弧度 ↓
		trig format plots=rad, 
		xtick = {-pi, -pi/2, 0, pi/2, pi},
		xticklabels = {\(-\pi\), \(-\frac{\pi}{2}\), \(0\), \(\frac{\pi}{2}\), \(\pi\)},
		ytick = {-3,-2,-1,0,1,2,3}, % 添加 y 轴刻度
		grid = both,
		grid style = {dashed, gray!30},
		legend pos = north west,
		legend style = {font=\small},
		width = 10cm,
		height = 7cm
		]
		
		% 绘制 x - sin(x)（修复函数参数单位）
		\addplot [
		domain = -pi:pi,
		samples = 200,
		color = blue,
		line width = 0.5pt,
		smooth
		] {x - sin(x)};
		\addlegendentry{\( x - \sin x\)};
		
		% 绘制 1 - cos(x)（修复函数参数单位）
		\addplot [
		domain = -pi:pi,
		samples = 200,
		color = red,
		line width = 0.5pt,
		dashed,
		smooth
		] {1 - cos(x)};
		\addlegendentry{\( 1 - \cos x\)};
		
		% 添加单调性说明（调整位置）
		%\node[blue, align=center] at (axis cs: 0.5, 1.5) 
		%{\footnotesize 单调递增 \\ \footnotesize (严格)};
		
		% 添加导数非负说明（调整位置）
		\node[red, align=center] at (axis cs: 1.5, -1.5) 
		{\footnotesize \(f'(x)\geq 0\)};
		
		% 添加关键点标注
		\draw[dashed, gray] (axis cs:pi,0) -- (axis cs:pi,pi);
		\fill[blue] (axis cs:pi,pi) circle (2pt) 
		node[above right] {\footnotesize \((\pi, \pi)\)};
		%\fill[red] (axis cs:pi,2) circle (2pt) 
		%node[above left, red] {\footnotesize \(y'_{\max}=2\)};
		\fill[black] (axis cs:0,0) circle (2pt) 
		node[below right] {\footnotesize \((0,0)\)};
		
	\end{axis}
\end{tikzpicture}
\end{document}